diff --git a/assets/src/bundles/save/index.js b/assets/src/bundles/save/index.js
--- a/assets/src/bundles/save/index.js
+++ b/assets/src/bundles/save/index.js
@@ -180,11 +180,16 @@
let html = '';
const sanitizedURL = $.fn.dataTable.render.text().display(data);
if (row.save_task_status === 'succeeded') {
- let browseOriginUrl = `${Urls.browse_origin()}?origin_url=${encodeURIComponent(sanitizedURL)}`;
- if (row.visit_date) {
- browseOriginUrl += `×tamp=${encodeURIComponent(row.visit_date)}`;
+ if (row.visit_status === 'full' || row.visit_status === 'partial') {
+ let browseOriginUrl = `${Urls.browse_origin()}?origin_url=${encodeURIComponent(sanitizedURL)}`;
+ if (row.visit_date) {
+ browseOriginUrl += `×tamp=${encodeURIComponent(row.visit_date)}`;
+ }
+ html += `${sanitizedURL}`;
+ } else {
+ const tooltip = 'origin was successfully loaded, waiting for data to be available in database';
+ html += `${sanitizedURL}`;
}
- html += `${sanitizedURL}`;
} else {
html += sanitizedURL;
}
diff --git a/cypress/fixtures/origin-save.json b/cypress/fixtures/origin-save.json
--- a/cypress/fixtures/origin-save.json
+++ b/cypress/fixtures/origin-save.json
@@ -2,85 +2,106 @@
"recordsTotal": 6839,
"draw": 2,
"recordsFiltered": 6839,
- "data": [{
- "id": 6869,
- "visit_type": "git",
- "origin_url": "https://gitlab.inria.fr/solverstack/maphys/maphys/",
- "save_request_date": "2020-03-25T15:57:21.725886+00:00",
- "save_request_status": "accepted",
- "save_task_status": "succeeded",
- "visit_date": "2020-03-25T16:23:15.309379+00:00"
- }, {
- "id": 6868,
- "visit_type": "git",
- "origin_url": "https://github.com/orthecreedence/cl-async.git",
- "save_request_date": "2020-01-17T09:39:55.930715+00:00",
- "save_request_status": "accepted",
- "save_task_status": "succeeded",
- "visit_date": "2020-01-17T09:47:20.992279+00:00"
- }, {
- "id": 6867,
- "visit_type": "git",
- "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/takin-data.git/",
- "save_request_date": "2020-01-17T07:16:54.421290+00:00",
- "save_request_status": "accepted",
- "save_task_status": "failed",
- "visit_date": "2020-01-17T07:46:35.223112+00:00"
- }, {
- "id": 6866,
- "visit_type": "git",
- "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/mcstas.git/",
- "save_request_date": "2020-01-17T07:16:43.411145+00:00",
- "save_request_status": "accepted",
- "save_task_status": "failed",
- "visit_date": "2020-01-17T07:46:32.710716+00:00"
- }, {
- "id": 6865,
- "visit_type": "git",
- "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/miezetools.git/",
- "save_request_date": "2020-01-17T07:16:31.085132+00:00",
- "save_request_status": "accepted",
- "save_task_status": "failed",
- "visit_date": "2020-01-17T07:46:32.634520+00:00"
- }, {
- "id": 6864,
- "visit_type": "git",
- "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tlibs.git/",
- "save_request_date": "2020-01-17T07:16:21.708408+00:00",
- "save_request_status": "accepted",
- "save_task_status": "failed",
- "visit_date": "2020-01-17T07:46:32.542717+00:00"
- }, {
- "id": 6863,
- "visit_type": "git",
- "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tastools.git/",
- "save_request_date": "2020-01-17T07:15:58.076850+00:00",
- "save_request_status": "accepted",
- "save_task_status": "failed",
- "visit_date": "2020-01-17T07:46:32.226750+00:00"
- }, {
- "id": 6862,
- "visit_type": "git",
- "origin_url": "https://github.com/openfun/flower-docker",
- "save_request_date": "2020-01-16T15:26:05.406086+00:00",
- "save_request_status": "accepted",
- "save_task_status": "succeeded",
- "visit_date": "2020-01-16T15:47:50.200655+00:00"
- }, {
- "id": 6861,
- "visit_type": "git",
- "origin_url": "https://gitlab.inria.fr/dsi_public/depots_officiels_inria_gitlab",
- "save_request_date": "2020-01-16T11:27:26.916797+00:00",
- "save_request_status": "accepted",
- "save_task_status": "succeeded",
- "visit_date": "2020-01-16T11:44:01.715665+00:00"
- }, {
- "id": 6860,
- "visit_type": "git",
- "origin_url": "https://github.com/SocialGouv/cdtn-run",
- "save_request_date": "2020-01-16T11:23:24.933159+00:00",
- "save_request_status": "accepted",
- "save_task_status": "succeeded",
- "visit_date": "2020-01-16T11:39:50.882730+00:00"
- }]
+ "data": [
+ {
+ "id": 6869,
+ "visit_type": "git",
+ "origin_url": "https://gitlab.inria.fr/solverstack/maphys/maphys/",
+ "save_request_date": "2020-03-25T15:57:21.725886+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "succeeded",
+ "visit_date": "2020-03-25T16:23:15.309379+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6868,
+ "visit_type": "git",
+ "origin_url": "https://github.com/orthecreedence/cl-async.git",
+ "save_request_date": "2020-01-17T09:39:55.930715+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "succeeded",
+ "visit_date": "2020-01-17T09:47:20.992279+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6867,
+ "visit_type": "git",
+ "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/takin-data.git/",
+ "save_request_date": "2020-01-17T07:16:54.421290+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "failed",
+ "visit_date": "2020-01-17T07:46:35.223112+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6866,
+ "visit_type": "git",
+ "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/mcstas.git/",
+ "save_request_date": "2020-01-17T07:16:43.411145+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "failed",
+ "visit_date": "2020-01-17T07:46:32.710716+00:00",
+ "visit_status": "failed"
+ },
+ {
+ "id": 6865,
+ "visit_type": "git",
+ "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/miezetools.git/",
+ "save_request_date": "2020-01-17T07:16:31.085132+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "failed",
+ "visit_date": "2020-01-17T07:46:32.634520+00:00",
+ "visit_status": "failed"
+ },
+ {
+ "id": 6864,
+ "visit_type": "git",
+ "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tlibs.git/",
+ "save_request_date": "2020-01-17T07:16:21.708408+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "failed",
+ "visit_date": "2020-01-17T07:46:32.542717+00:00",
+ "visit_status": "failed"
+ },
+ {
+ "id": 6863,
+ "visit_type": "git",
+ "origin_url": "https://forge.frm2.tum.de/cgit/cgit.cgi/frm2/mira/tastools.git/",
+ "save_request_date": "2020-01-17T07:15:58.076850+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "failed",
+ "visit_date": "2020-01-17T07:46:32.226750+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6862,
+ "visit_type": "git",
+ "origin_url": "https://github.com/openfun/flower-docker",
+ "save_request_date": "2020-01-16T15:26:05.406086+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "succeeded",
+ "visit_date": "2020-01-16T15:47:50.200655+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6861,
+ "visit_type": "git",
+ "origin_url": "https://gitlab.inria.fr/dsi_public/depots_officiels_inria_gitlab",
+ "save_request_date": "2020-01-16T11:27:26.916797+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "succeeded",
+ "visit_date": "2020-01-16T11:44:01.715665+00:00",
+ "visit_status": "full"
+ },
+ {
+ "id": 6860,
+ "visit_type": "git",
+ "origin_url": "https://github.com/SocialGouv/cdtn-run",
+ "save_request_date": "2020-01-16T11:23:24.933159+00:00",
+ "save_request_status": "accepted",
+ "save_task_status": "succeeded",
+ "visit_date": "2020-01-16T11:39:50.882730+00:00",
+ "visit_status": "full"
+ }
+ ]
}
\ No newline at end of file
diff --git a/cypress/integration/origin-save.spec.js b/cypress/integration/origin-save.spec.js
--- a/cypress/integration/origin-save.spec.js
+++ b/cypress/integration/origin-save.spec.js
@@ -330,6 +330,33 @@
});
});
+ it('should not add link to browse an origin when there is no visit status', function() {
+ const originUrl = 'https://git.example.org/example.git';
+ const saveRequestData = genOriginSaveResponse({
+ saveRequestStatus: 'accepted',
+ originUrl: originUrl,
+ saveTaskStatus: 'succeeded',
+ visitDate: null,
+ visitStatus: null
+ });
+ const saveRequestsListData = {
+ 'recordsTotal': 1,
+ 'draw': 2,
+ 'recordsFiltered': 1,
+ 'data': [saveRequestData]
+ };
+ cy.intercept('/save/requests/list/**', {body: saveRequestsListData})
+ .as('saveRequestsList');
+ cy.get('#swh-origin-save-requests-list-tab').click();
+ cy.wait('@saveRequestsList');
+ cy.get('tbody tr').then(rows => {
+ const firstRowCells = rows[0].cells;
+ const tooltip = 'origin was successfully loaded, waiting for data to be available in database';
+ const expectedContent = `${originUrl}`;
+ expect($(firstRowCells[2]).html()).to.have.string(expectedContent);
+ });
+ });
+
it('should display/close task info popover when clicking on the info button', function() {
cy.intercept('/save/requests/list/**', {fixture: 'origin-save'});
cy.intercept('/save/task/info/**', {fixture: 'save-task-info'});